using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsUserControl.Dialogs
{
    /// <summary>
    /// 
    /// </summary>
    /// <param name="Input"></param>
    public delegate void InputBoxResponse(string Input);

    /// <summary>
    /// 
    /// </summary>
    public delegate void CancelInputBox();

    /// <summary>
    /// 
    /// </summary>
    public partial class InputBox : Form
    {
        /// <summary></summary>
        public event InputBoxResponse InputboxResponseEvent;

        /// <summary></summary>
        public event CancelInputBox CancelInputboxEvent;

        private string _Prompt;
        /// <summary>
        /// 
        /// </summary>
        public InputBox(string prompt)
        {
            this._Prompt = prompt;
            InitializeComponent();
        }

        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (this.InputboxResponseEvent != null)
            {
                this.InputboxResponseEvent(this.txt_Input.Text);
            }
            this.Dispose();
        }

        private void btn_Cancel_Click(object sender, EventArgs e)
        {
            if (this.CancelInputboxEvent != null)
            {
                this.CancelInputboxEvent();
            }
            this.Dispose();
        }

        private void InputBox_Load(object sender, EventArgs e)
        {
            this.lblPrompt.Text = this._Prompt;
        }
    }
}